ScCompiler.buildDummySamplerForCombinedImages

Analyzes all OpImageFetch (texelFetch) opcodes and checks if there are instances where said instruction is used without a combined image sampler. GLSL targets do not support the use of texelFetch without a sampler. To workaround this, we must inject a dummy sampler which can be used to form a sampler2D at the call-site of texelFetch as necessary.

This must be called before buildCombinedImageSamplers(). buildCombinedImageSamplers() may refer to the ID returned by this method if the returned ID is non-zero. The return value will be the ID of a sampler object if a dummy sampler is necessary, or 0 if no sampler object is required.

If the returned ID is non-zero, it can be decorated with set/bindings as desired before calling compile(). Calling this function also invalidates getActiveInterfaceVariables(), so this should be called before that function.

class ScCompiler
uint
buildDummySamplerForCombinedImages
()

Meta